$(document).ready(function() {
	// loading  加载
	var stop = true;
	var page = 2;
	$(window).scroll(function() {
		
		var totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
		if ($(document).height() <= totalheight) {
			if (stop == true) {
				stop = false;
				$.ajax({
					url: url,
					type: 'post',
					dataType: 'json',
					data: {
						page: page
					},
					success: function(data) {
						var html = '';
						var data = data.data;
						console.log(data)
						var indexlist = data.product_lst;
						var indexlength = indexlist.length;
						for (var i = 0; i < indexlength; i++) {
							html +='<li>'+
										'<a href="'+href+''+indexlist[i].product_id+'">'+
										'<div class="zhuanqu_listimg"><img src="'+indexlist[i].thumb_img+'" alt=""></div>'+
											'<p>'+indexlist[i].title+'</p>'+
											'<div class="zhuanqu_des">'+
												'<img src="'+imgSrc+'/images/4_19.png" alt="">'+
												''+indexlist[i].npoint+''+
												// '<span>'+indexlist[i].price+'</span>'+
											'</div>';
											if (indexlist[i].user_level != 0) {
												html +='<div class="dengji">'+
															'<div id="triangle_left"></div>'+
															'LV'+indexlist[i].user_level+'以上专享'+
														'</div>';
											}else{
											}
										html += '</a>'+
									'</li>'
						};
						$('#zhuanqu_list').append(html)
						stop = true;
						page++;
						if (indexlength == 0) {
							$(".Loading").html("全部加载完！");
							stop = false;
						} else {
							$(".Loading").html("Loading...");
						}
					},
					error:function(xhr, textStatus){
						if(xhr.status == 401){
							 window.location.href = "/Npoint_store/Login";
						}else{
							alert(xhr.status+'错误')
						}

					}
				})
			}
		}
	});
});